#pragma once

#include "physical.h"
#include <osg\Node>
#include <osg\ref_ptr>
#include "vrdatacore_global.h"

namespace CoreBase
{
	class Scene;
}

namespace VrDataCore
{
	class VRDATACORE_EXPORT Mesh:public CoreBase::Physical
	{
	public:
		Mesh(CoreBase::ActorBase* owneractor,const QString& name = "Mesh");
		Mesh(osg::MatrixTransform& node,CoreBase::ActorBase* owneractor, const QString& name = "Mesh");

		virtual void addedToScene(CoreBase::Scene* scene);
		void setMeshFile(const QString& file);
		QString getMeshFile();
		void setCollisionType(QString type);
		QString getCollisionType();

		void setCollision(bool isadd);
		osg::ref_ptr<osg::Node> getMeshNode()
		{
			return _node;
		}
	protected:
		~Mesh();
		void loadMesh();
		QString								_meshFile;
		osg::ref_ptr<osg::Node>				_node;
		QString								_collisionType;
		bool								_haveRegister;
	};
}